package com.demo;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @version 1.0
 * @Description:
 * @author: luobiao
 * @Date 2023/4/27 18:24
 */
public class HelloJob implements Job {
    private static Logger logger = LoggerFactory.getLogger(HelloJob.class);
    private static int count = 0;

    public void execute(JobExecutionContext context) throws JobExecutionException {

        logger.info("执行作业={}",
                context.getTrigger().getKey() + "----->" + (System.currentTimeMillis() / 1000));
        try {
            if (count == 0) {
                System.out.println("--------------------------> 休眠12s");
                Thread.sleep(12000);
            }
            count++;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
